Repository navigation
fix(gitops): scope installation tokens to the destination repository - #11
patrickleet wants to merge 1 commit into
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Your preview environment has been published! 🚀 |
Dry Run: Preview (Promotion PR)Workflow validation completed successfully. Settings
Completed
Skipped (dry run)
Environment Diffdiff --git a/.gitops/deploy/helm/templates/workflows-gitops-pr-11.yaml b/.gitops/deploy/helm/templates/workflows-gitops-pr-11.yaml
new file mode 100644
index 0000000..0e0af30
--- /dev/null
+++ b/.gitops/deploy/helm/templates/workflows-gitops-pr-11.yaml
@@ -0,0 +1,58 @@
+---
+# Source: promotion/templates/application.yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Application
+metadata:
+ name: test-project-workflows-gitops-pr-11
+ namespace: argocd
+ finalizers:
+ - resources-finalizer.argocd.argoproj.io
+spec:
+ project: test-project
+ source:
+ path: .gitops/deploy/helm
+ repoURL: https://github.com/hops-ops/workflows-gitops.git
+ targetRevision: metaforge-staging-cutover
+ helm:
+ version: v3
+ values: |
+ env:
+ test: true
+ type: preview
+ method: promotion-pr
+ event: pr
+ image:
+ tag: pr-11-77a512d0ffd89a8e1b13a9a4b75a2ce3312d2176
+ destination:
+ namespace: workflows-gitops-pr-11
+ server: https://kubernetes.default.svc
+ syncPolicy:
+ automated:
+ selfHeal: true
+ prune: true
+---
+# Source: promotion/templates/preview-resources.yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Application
+metadata:
+ name: something
+ namespace: argocd
+ annotations:
+ argocd.argoproj.io/sync-wave: "-1"
+ finalizers:
+ - resources-finalizer.argocd.argoproj.io
+spec:
+ project: test-project
+ source:
+ path: .gitops/deploy/helm
+ repoURL: https://github.com/unbounded-tech/something.git
+ targetRevision: main
+ helm:
+ version: v3
+ destination:
+ namespace: workflows-gitops-pr-11
+ server: https://kubernetes.default.svc
+ syncPolicy:
+ automated:
+ selfHeal: true
+ prune: trueGenerated Output File---
# Source: promotion/templates/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: test-project-workflows-gitops-pr-11
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: test-project
source:
path: .gitops/deploy/helm
repoURL: https://github.com/hops-ops/workflows-gitops.git
targetRevision: metaforge-staging-cutover
helm:
version: v3
values: |
env:
test: true
type: preview
method: promotion-pr
event: pr
image:
tag: pr-11-77a512d0ffd89a8e1b13a9a4b75a2ce3312d2176
destination:
namespace: workflows-gitops-pr-11
server: https://kubernetes.default.svc
syncPolicy:
automated:
selfHeal: true
prune: true
---
# Source: promotion/templates/preview-resources.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: something
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "-1"
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: test-project
source:
path: .gitops/deploy/helm
repoURL: https://github.com/unbounded-tech/something.git
targetRevision: main
helm:
version: v3
destination:
namespace: workflows-gitops-pr-11
server: https://kubernetes.default.svc
syncPolicy:
automated:
selfHeal: true
prune: true
|
Dry Run: Release (Promotion)Workflow validation completed successfully. Settings
Completed
Skipped (dry run)
Environment Diffdiff --git a/.gitops/deploy/helm/templates/workflows-gitops.yaml b/.gitops/deploy/helm/templates/workflows-gitops.yaml
index baa560a..6f9fa27 100644
--- a/.gitops/deploy/helm/templates/workflows-gitops.yaml
+++ b/.gitops/deploy/helm/templates/workflows-gitops.yaml
@@ -12,7 +12,7 @@ spec:
source:
path: .gitops/deploy/helm
repoURL: https://github.com/hops-ops/workflows-gitops.git
- targetRevision: v2.1.3
+ targetRevision: refs/pull/11/merge
helm:
version: v3
values: |
@@ -20,7 +20,7 @@ spec:
test: true
type: release
method: promotion
- event: v-tag
+ event: pr
destination:
namespace: test-project
server: https://kubernetes.default.svcGenerated Output File---
# Source: promotion/templates/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: test-project-workflows-gitops
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: test-project
source:
path: .gitops/deploy/helm
repoURL: https://github.com/hops-ops/workflows-gitops.git
targetRevision: refs/pull/11/merge
helm:
version: v3
values: |
env:
test: true
type: release
method: promotion
event: pr
destination:
namespace: test-project
server: https://kubernetes.default.svc
syncPolicy:
automated:
selfHeal: true
prune: true
|
Dry Run: Preview (Promotion PR)Workflow validation completed successfully. Settings
Completed
Skipped (dry run)
Environment Diffdiff --git a/.gitops/deploy/helm/templates/workflows-gitops-pr-11.yaml b/.gitops/deploy/helm/templates/workflows-gitops-pr-11.yaml
new file mode 100644
index 0000000..013fe69
--- /dev/null
+++ b/.gitops/deploy/helm/templates/workflows-gitops-pr-11.yaml
@@ -0,0 +1,58 @@
+---
+# Source: promotion/templates/application.yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Application
+metadata:
+ name: test-project-workflows-gitops-pr-11
+ namespace: argocd
+ finalizers:
+ - resources-finalizer.argocd.argoproj.io
+spec:
+ project: test-project
+ source:
+ path: .gitops/deploy/helm
+ repoURL: https://github.com/hops-ops/workflows-gitops.git
+ targetRevision: metaforge-staging-cutover
+ helm:
+ version: v3
+ values: |
+ env:
+ test: true
+ type: preview
+ method: promotion-pr-merge
+ event: pr
+ image:
+ tag: pr-11-77a512d0ffd89a8e1b13a9a4b75a2ce3312d2176
+ destination:
+ namespace: workflows-gitops-pr-11
+ server: https://kubernetes.default.svc
+ syncPolicy:
+ automated:
+ selfHeal: true
+ prune: true
+---
+# Source: promotion/templates/preview-resources.yaml
+apiVersion: argoproj.io/v1alpha1
+kind: Application
+metadata:
+ name: something
+ namespace: argocd
+ annotations:
+ argocd.argoproj.io/sync-wave: "-1"
+ finalizers:
+ - resources-finalizer.argocd.argoproj.io
+spec:
+ project: test-project
+ source:
+ path: .gitops/deploy/helm
+ repoURL: https://github.com/unbounded-tech/something.git
+ targetRevision: main
+ helm:
+ version: v3
+ destination:
+ namespace: workflows-gitops-pr-11
+ server: https://kubernetes.default.svc
+ syncPolicy:
+ automated:
+ selfHeal: true
+ prune: trueGenerated Output File---
# Source: promotion/templates/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: test-project-workflows-gitops-pr-11
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: test-project
source:
path: .gitops/deploy/helm
repoURL: https://github.com/hops-ops/workflows-gitops.git
targetRevision: metaforge-staging-cutover
helm:
version: v3
values: |
env:
test: true
type: preview
method: promotion-pr-merge
event: pr
image:
tag: pr-11-77a512d0ffd89a8e1b13a9a4b75a2ce3312d2176
destination:
namespace: workflows-gitops-pr-11
server: https://kubernetes.default.svc
syncPolicy:
automated:
selfHeal: true
prune: true
---
# Source: promotion/templates/preview-resources.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: something
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "-1"
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: test-project
source:
path: .gitops/deploy/helm
repoURL: https://github.com/unbounded-tech/something.git
targetRevision: main
helm:
version: v3
destination:
namespace: workflows-gitops-pr-11
server: https://kubernetes.default.svc
syncPolicy:
automated:
selfHeal: true
prune: true
|
Dry Run: Release (Promotion PR)Workflow validation completed successfully. Settings
Completed
Skipped (dry run)
Environment Diffdiff --git a/.gitops/deploy/helm/templates/workflows-gitops.yaml b/.gitops/deploy/helm/templates/workflows-gitops.yaml
index baa560a..075a1d9 100644
--- a/.gitops/deploy/helm/templates/workflows-gitops.yaml
+++ b/.gitops/deploy/helm/templates/workflows-gitops.yaml
@@ -12,15 +12,15 @@ spec:
source:
path: .gitops/deploy/helm
repoURL: https://github.com/hops-ops/workflows-gitops.git
- targetRevision: v2.1.3
+ targetRevision: refs/pull/11/merge
helm:
version: v3
values: |
env:
test: true
type: release
- method: promotion
- event: v-tag
+ method: promotion-pr-merge
+ event: pr
destination:
namespace: test-project
server: https://kubernetes.default.svcGenerated Output File---
# Source: promotion/templates/application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: test-project-workflows-gitops
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: test-project
source:
path: .gitops/deploy/helm
repoURL: https://github.com/hops-ops/workflows-gitops.git
targetRevision: refs/pull/11/merge
helm:
version: v3
values: |
env:
test: true
type: release
method: promotion-pr-merge
event: pr
destination:
namespace: test-project
server: https://kubernetes.default.svc
syncPolicy:
automated:
selfHeal: true
prune: true
|
|
@gitkb-rabbit review |
GitHub App authentication requests a token for every repository in the caller organization's installation. The promotion and cleanup jobs use that token to write one configured environment repository. Adding a repository to the installation therefore exposes it to existing preview jobs.
Validate the configured
owner/repoagainst the caller's organization and request a token for that repository alone. The selected repository, promotion and cleanup commands, and PAT authentication path retain their existing contracts.Both token-scope steps passed same-organization, malformed, and cross-organization cases. The existing merge and value-composition contracts also passed.